--------Copy these files into your microtronix kernel source directory;
drivers/usb/host/ohs900-hcd.c 
drivers/usb/host/ohs900.h 
include/linux/usb_ohs900.h.


--------Modify (drivers/usb/Kconfig)
config USB
	tristate "Support for Host-side USB"
	depends on PCI || SA1111 || ARCH_OMAP1510 || ARCH_OMAP1610 || ARCH_LH7A404 || NIOS || NIOS2

 
--------Modify (drivers/usb/host/Kconfig)
config USB_OHS900_HCD
        tristate "OHS900 HCD support"
        depends on USB
        default N
        help
          The OHS900 is a single-port USB controller that supports either
          host side or peripheral side roles.  Enable this option if your
          board has this core, and you want to use it as a host controller. 
          If unsure, say N.

          To compile this driver as a module, choose M here: the
          module will be called ohs900-hcd. 


-------add to usb/host/Makefile
obj-$(CONFIG_USB_OHS900_HCD)	+= ohs900-hcd.o

------add to usb/Makefile
obj-$(CONFIG_USB_OHS900_HCD)	+= host/





----------------- add the following to asm-nios2nommu/dma_mapping.h:




#include <asm/scatterlist.h>
#include <linux/mm.h>
#include <asm/io.h>
#include <asm/cacheflush.h>
 
static inline dma_addr_t
dma_map_single(struct device *dev, void *cpu_addr, size_t size,
       enum dma_data_direction dir)
{
cache_push ((unsigned long)cpu_addr, size);
return virt_to_bus((unsigned long)cpu_addr);
}

/**
* dma_unmap_single - unmap a single buffer previously mapped
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @handle: DMA address of buffer
* @size: size of buffer to map
* @dir: DMA transfer direction
*
* Unmap a single streaming mode DMA translation.  The handle and size
* must match what was provided in the previous dma_map_single() call.
* All other usages are undefined.
*
* After this call, reads by the CPU to the buffer are guaranteed to see
* whatever the device wrote there.
*/
static inline void
dma_unmap_single(struct device *dev, dma_addr_t handle, size_t size,
  enum dma_data_direction dir)
{
cache_clear((unsigned long)bus_to_virt(handle), size);
}

/**
* dma_map_sg - map a set of SG buffers for streaming mode DMA
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @sg: list of buffers
* @nents: number of buffers to map
* @dir: DMA transfer direction
*
* Map a set of buffers described by scatterlist in streaming
* mode for DMA.  This is the scatter-gather version of the
* above dma_map_single interface.  Here the scatter gather list
* elements are each tagged with the appropriate dma address
* and length.  They are obtained via sg_dma_{address,length}(SG).
*
* NOTE: An implementation may be able to use a smaller number of
*       DMA address/length pairs than there are SG table elements.
*       (for example via virtual mapping capabilities)
*       The routine returns the number of addr/length pairs actually
*       used, at most nents.
*
* Device ownership issues as mentioned above for dma_map_single are
* the same here.
*/
static inline int
dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
   enum dma_data_direction dir)
{
int i;

for (i = 0; i < nents; i++, sg++) {
 char *virt;

 sg->dma_address = page_to_bus(sg->page) + sg->offset;
 virt = page_address(sg->page) + sg->offset;
 cache_push ((unsigned long)virt, sg->length);
}

return nents;
}

/**
* dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
* @sg: list of buffers
* @nents: number of buffers to map
* @dir: DMA transfer direction
*
* Unmap a set of streaming mode DMA translations.
* Again, CPU read rules concerning calls here are the same as for
* dma_unmap_single() above.
*/
static inline void
dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
     enum dma_data_direction dir)
{
int i;

for (i = 0; i < nents; i++, sg++) {
 char *virt;
 virt = page_address(sg->page) + sg->offset;
 cache_clear ((unsigned long)virt, sg->length);
}
}
 


------------ add the following line to the file asm-nios2nommu/cacheflush.h
extern void cache_clear (unsigned long paddr, int len); 




-------- Modify arch/nios2nommu/mm/init.c, toward the bottom of the paging_init() function.
 
zones_size[ZONE_DMA] = (4*1024*1024) >> PAGE_SHIFT;
zones_size[ZONE_NORMAL] = ((end_mem - PAGE_OFFSET) >> PAGE_SHIFT) - zones_size[ZONE_DMA]; 


 
--------- Or you can give all sdram to ZONE_DMA and leave the ZONE_NORMAL empty (as long as all you sdram is dma-able). 
		zones_size[ZONE_NORMAL] = 0 >> PAGE_SHIFT;
		zones_size[ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;


-------add preprocessor directives to include/linux/compiler.h
#ifdef __CHECKER__
# define __acquires(x)	__attribute__((context(0,1)))
# define __releases(x)	__attribute__((context(1,0)))
# define __acquire(x)	__context__(1)
# define __release(x)	__context__(-1)
#else
# define __acquires(x)
# define __releases(x)
# define __acquire(x) (void)0
# define __release(x) (void)0
#endif


---- add to usb/core/hcd.h
extern void usb_hcd_release (struct usb_bus *);

---- add to usb/core/hcd.c
/*-------------------------------------------------------------------------*/

void usb_hcd_release(struct usb_bus *bus)
{
	struct usb_hcd *hcd;

	hcd = container_of (bus, struct usb_hcd, self);
	kfree(hcd);
}
EXPORT_SYMBOL (usb_hcd_release);



--------- modify filesystem from IDE
---add files under /dev
@sda,b,8,0
@sda1,b,8,1
---add file under /mnt
usb


-------------- Configure kernel - add SCSI disk support 
Device Drivers --->
  SCSI Device Support --->
    Select "Legacy /proc/scsi/ support"
    Select "SCSI disk support"

-------------- Configure kernel - add IO char set support
File Systems --->
  Native Language Support --->
    Select "CodePage 437"
    Select "NLS ISO 8859-1"

----------------------------- At Linux cmd prompt
mount -n -t usbfs none /proc/bus/usb
mount -n -t vfat /dev/sda1 /mnt/usb


------------ check the partitions
# cat /proc/partitions
cat /proc/partitions
major minor  #blocks  name

   3     0      62976 hda
   3     1      62960 hda1
  31     0       4096 mtdblock0
  31     1       2048 mtdblock1
  31     2       1024 mtdblock2
  31     3       1024 mtdblock3
   8     0      63488 sda
   8     1      63457 sda1
# cat /proc/scsi/scsi
cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: I0MEGA   Model: UMni64MB*IOM2C4  Rev:     
  Type:   Direct-Access                    ANSI SCSI revision: 02
# 

